home *** CD-ROM | disk | FTP | other *** search
- Path: yarrina.connect.com.au!usenet
- From: Andrew Dalgleish <andrewd@axonet.com.au>
- Newsgroups: comp.lang.c++
- Subject: Re: Dynamic Casting / RTTI
- Date: Thu, 21 Mar 1996 10:45:47 +1000
- Organization: Axon Research, Pty Ltd
- Message-ID: <3150A6BB.3A9C@axonet.com.au>
- References: <DoJF68.Mx8@news.uwindsor.ca>
- NNTP-Posting-Host: andrew.axonet.com.au
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Saed Aryan,13325,1100,g wrote:
- > --- How do can I obtain a 'Deri' class pointer to the same object as pB?
- >
- > sort of like: Deri * pD = dynamic_cast<Deri*>(pB);
- > but this yields an error:
- > cannot dynamic_cast `pB' (of type `class Base *') to type `class Deri
-
- dynamic_cast only works if the classes have virtual functions.
- The pointer to the rtti is stored in the vtable.
-
- --
- Andrew Dalgleish
-